package me.leiusual.sharing.ui.home

import androidx.lifecycle.ViewModel
import dagger.Binds
import dagger.Module
import dagger.android.ContributesAndroidInjector
import dagger.multibindings.IntoMap
import me.leiusual.sharing.di.FragmentScope
import me.leiusual.sharing.di.ViewModelKey

/**
 * Create by leiusual on 2018/8/14
 */
@Module
abstract class HomeModule {

  @FragmentScope
  @ContributesAndroidInjector
  abstract fun homeHomeFragment(): HomeHomeFragment

  @Binds
  @IntoMap
  @ViewModelKey(HomeHomeViewModel::class)
  abstract fun homeHomeViewModel(homeHomeViewModel: HomeHomeViewModel): ViewModel

  @FragmentScope
  @ContributesAndroidInjector
  abstract fun homeSearchFragment(): HomeSearchFragment

  @Binds
  @IntoMap
  @ViewModelKey(HomeSearchViewModel::class)
  abstract fun homeSearchViewModel(homeSearchViewModel: HomeSearchViewModel): ViewModel

  @FragmentScope
  @ContributesAndroidInjector
  abstract fun homeSearchProductFragment(): HomeSearchProductFragment

  @Binds
  @IntoMap
  @ViewModelKey(HomeSearchProductViewModel::class)
  abstract fun homeSearchProductViewModel(homeSearchProductViewModel: HomeSearchProductViewModel): ViewModel

  @FragmentScope
  @ContributesAndroidInjector
  abstract fun homeSearchStoreFragment(): HomeSearchStoreFragment

  @Binds
  @IntoMap
  @ViewModelKey(HomeSearchStoreViewModel::class)
  abstract fun homeSearchStoreViewModel(homeSearchStoreViewModel: HomeSearchStoreViewModel): ViewModel
}